var fs = require('fs');

fs.readFile('logo.png', (err,data) => {
    if(err) throw err;
    console.log(data);

    fs.writeFile('logo_new.png', data, (err) => {
        if(err) throw err;
    })

    var base64Image = data.toString('base64');
    console.log(base64Image);

    var decodedImage = new Buffer(base64Image, 'base64');

    console.log(Buffer.compare(data, decodedImage));

    fs.writeFile('logo_decoded.png', decodedImage, (err) => {
        if(err) throw err;
    })
})
